﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using JSMS.Filter;
using Easy4net.DBUtility;
using JSMS.Model;
using Easy4net.Common;
using Newtonsoft.Json;

namespace JSMS.Controllers
{
    public class StudentController : Controller
    {
        //学生页面的控制器
        // GET: /Student/
        [IsLoginFilter]
        public ActionResult Index()
        {
            DBHelper db = DBHelper.getInstance();
            string sql = "SELECT * FROM job_view ";
            ParamMap param = ParamMap.newMap();
            param.setOrderFields("id",false);
            param.setPageParamters(1,10);
            PageResult<JobView> result = db.FindPage<JobView>(sql,param);
            ViewData["pageResult"] = result;
            return View();
        }
        [HttpPost]
        public JsonResult Page(int currentPage)
        {
            DBHelper db = DBHelper.getInstance();
            string sql = "SELECT * FROM job_view ";
            ParamMap param = ParamMap.newMap();
            param.setOrderFields("id", false);
            param.setPageParamters(currentPage, 10);
            List<JobView> result=db.FindBySql<JobView>(sql,param);
            //String data = JsonConvert.SerializeObject(result);
            JsonSerializerSettings jss = new JsonSerializerSettings()
            {
                DateFormatHandling = DateFormatHandling.MicrosoftDateFormat,
                DateTimeZoneHandling = DateTimeZoneHandling.Utc
            };
            return Json(result);
        }

    }
}
